<template>
  <div>
    <el-row>
      <el-col :span="24">
        <el-form :inline="true" class="demo-form-inline">
          <el-form-item label="">
            <el-input
              v-model="foodName"
              size="medium"
              placeholder="查询"
              clearable
            ></el-input>
          </el-form-item>
          <el-form-item>
            <el-button
              size="small"
              type="success"
              @click="getRecord"
              icon="el-icon-search"
              >查询</el-button
            >
          </el-form-item>
          <el-form-item label="">
            <el-button
              size="small"
              type="primary"
              @click="newest(1)"
              icon="el-icon-circle-plus-outline"
              >新增</el-button
            >
          </el-form-item>
        </el-form>
      </el-col>
      <el-col :span="24">
        <div>
          <el-table :data="tableData" border style="width: 100%">
            <el-table-column prop="name" label="序号" width="">
            </el-table-column>
            <el-table-column prop="name" label="合同类型" width="">
            </el-table-column>
            <el-table-column prop="name" label="销售对象" width="">
            </el-table-column>
            <el-table-column prop="name" label="签订时间" width="">
            </el-table-column>
            <el-table-column prop="name" label="标的物" width="">
            </el-table-column>
            <el-table-column prop="name" label="合同金额" width="">
            </el-table-column>

            <el-table-column label="操作" width="250" align="center">
              <template #default="scope">
                <el-button size="mini" @click="editorPara(scope.row, 2)"
                  >编辑</el-button
                >
                <el-button
                  size="mini"
                  type="danger"
                  @click="handleDelete(scope.row)"
                  >删除</el-button
                >
              </template>
            </el-table-column>
          </el-table>
        </div>
      </el-col>
    </el-row>
    <el-dialog
      :title="single"
      v-model="plassets"
      width="40%"
      :close-on-click-modal="false"
    >
      <el-form :model="form" ref="form" label-width="80px">
        <el-form-item label="合同类型">
          <el-select
            v-model="form.subtype"
            placeholder="请选择"
            style="width: 300px"
          >
            <el-option
              v-for="item in contracts"
              :key="item.value"
              :label="item.label"
              :value="item.value"
            >
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="销售对象">
          <el-input v-model="form.salestarget" style="width: 300px"></el-input>
        </el-form-item>
        <el-form-item label="签订时间">
          <el-date-picker
            style="width: 300px"
            v-model="form.dates"
            type="date"
            placeholder="选择日期"
            format="YYYY 年 MM 月 DD 日"
          >
          </el-date-picker>
        </el-form-item>
        <el-form-item label="标的物">
          <el-input v-model="form.details" style="width: 300px"></el-input>
        </el-form-item>
        <el-form-item label="合同金额">
          <el-input v-model="form.amount" style="width: 300px"></el-input>
        </el-form-item>
      </el-form>
      <template #footer>
        <span class="dialog-footer">
          <el-button @click="plassets = false">取 消</el-button>
          <el-button type="primary" v-if="under == 1" @click="determine()"
            >确 定</el-button
          >
          <el-button @click="hardware()" v-else type="primary"
            >编辑 确 定</el-button
          >
        </span>
      </template>
    </el-dialog>
  </div>
</template>

<script>
export default {
  data() {
    return {
      foodName: "",
      plassets: false,
      single: "",
      under: 1,
      form: {
        subtype: "",
        salestarget: "",
        dates: "",
        details: "",
        amount: "",
      },
      contracts: [
        {
          value: "1",
          label: "产品销售",
        },
        {
          value: "2",
          label: "技术服务",
        },
      ],
      tableData: [],
    };
  },
  methods: {
    newest(index) {
      this.under = index;
      this.single = "新增供应商";
      this.plassets = true;
    },
    getRecord() {},
  },
};
</script>

<style scoped>
</style>